package com.qingcheng.dao;

import com.qingcheng.pojo.order.Ordercounts;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.Map;

public interface OrdercountsMapper extends Mapper<Ordercounts> {



    public  Map<String, Object> insertList();

    /**浏览人数*/
    @Select("select count(1) from tb_order_stieip")
    public Integer findbybrowsepbno();
    /**下单人数*/
    @Select("select count(DISTINCT username) from tb_order")
    public Integer findbyorderpbno();
    /**订单数*/
    @Select("select count(1) from tb_order")
    public Integer findbyorderno();
    /**下单件数*/
    @Select("select sum(total_num) from tb_order where total_num is not null")
    public Integer findbyquantityno();
    /**有效订单数*/
    @Select("select count(1) from tb_order where pay_type in(1,2,3,4)")
    public Integer findbyvalidorderno();
    /**下单金额*/
    @Select("select sum(pay_money) from tb_order")
    public Integer findbyquantitymoney();



    /**退款金额*/
    @Select("select sum(return_money) from tb_return_Order")
    public Integer findbyrefundmoney();
    /**付款人数*/
    @Select("select count(DISTINCT username) from tb_order where pay_type in(1,2,3,4)")
    public Integer findbypaymentpbno();
    /**付款订单数*/
    @Select("select count(1) from tb_order where pay_status = '1'")
    public Integer findbypaymentno();
    /**付款件数*/
    @Select("select sum((select sum(total_num) from tb_order where pay_status= '1')-(select sum(num) from tb_return_order_item))")
    public Integer findbypayno();
    /**付款金额*/
    @Select("select sum(pay_money) from tb_order")
    public Integer findbypaymentmoney();
    /**客单价*/
    @Select("select (select sum(pay_money) from tb_order)/(select count(DISTINCT username) from tb_order)")
    public Integer findbycustmoney();

}
